﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="TextBox" x:Key="CbrStandardTextBox">
    	<Setter Property="MinHeight" Value="22"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{DynamicResource CbrTextBoxBackground}"/>
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="CaretBrush" Value="{DynamicResource CbrForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                        <ScrollViewer x:Name="PART_ContentHost" Margin="1"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{DynamicResource CbrTextBoxBackgroundSelected}"/>
                        </Trigger>
                        <Trigger Property="IsFocused" Value="true">
                            <Setter Property="Background" Value="{DynamicResource CbrTextBoxBackgroundSelected}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

	<Style TargetType="PasswordBox" x:Key="CbrPasswordTextBox">
		<Setter Property="MinHeight" Value="22"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
		<Setter Property="Background" Value="{DynamicResource CbrTextBoxBackground}"/>
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="CaretBrush" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type PasswordBox}">
					<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
						<ScrollViewer x:Name="PART_ContentHost" Margin="1"/>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="true">
							<Setter Property="Background" Value="{DynamicResource CbrTextBoxBackgroundSelected}"/>
						</Trigger>
						<Trigger Property="IsFocused" Value="true">
							<Setter Property="Background" Value="{DynamicResource CbrTextBoxBackgroundSelected}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="TextBox" x:Key="CbrSearchTextBox">
        <Setter Property="Background" Value="{DynamicResource CbrTextBoxBackground}"/>
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="CaretBrush" Value="{DynamicResource CbrForegroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                        <TextBlock Foreground="{DynamicResource CbrSearchTextForeground}" Margin="5,0,0,0" 
                                   VerticalAlignment="Center" Name="search" Text="Search ..." Visibility="Hidden"/>
                        <ScrollViewer x:Name="PART_ContentHost" Margin="1"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TextBox.Text" Value="">
                            <Setter TargetName="search" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="TextBox.Text" Value="{x:Null}">
                            <Setter TargetName="search" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{DynamicResource CbrTextBoxBackgroundSelected}" />
							<Setter TargetName="search" Property="Foreground" Value="{DynamicResource CbrForegroundBrush}" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="true">
                            <Setter Property="Background" Value="{DynamicResource CbrTextBoxBackgroundSelected}" />
                            <Setter TargetName="search" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>